package cn.wsalix.templet.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.SimpleEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "PRO_PROJECT")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(callSuper = false, exclude = { "siteInfos" })
@ToString(exclude = "siteInfos")
public class Project extends SimpleEntity {
	private static final long serialVersionUID = 9027885954610744145L;
	@Column(name = "ICON", length = 500)
	private String icon;
	private String workDir; // 本地目录
	private String localPath; // 本地目录
	private String srcDir; // 本地目录
	private String title;
	private String remark;
	private String pkgName;// ex:org.jskyme
	private boolean supportGit;
	private boolean supportSvn;
	private String owner;// 项目用户

	@JsonIgnore
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	private Set<SiteInfo> siteInfos;

}
